﻿@{ 
    string[] tags = ViewBag.tags;
    User blogUser=  ViewBag.blogUser ;
    Repository repository = ViewBag.repository;
}
<!--标签页-->
<!DOCTYPE html>
<html lang="zh-CN">
@await Html.PartialAsync("Header")
<body ondragstart="return false;" class="dark-theme">
    @await Html.PartialAsync("BodyTempLate")
    <div class="main-content" data-aos="fade-left" data-aos-duration="400">
        <div class="toolbar header bg-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}} color-white">
            <button class="icon-button" onclick="SideMenu.toggle(document.querySelector('#navigation-sidemenu'))"><i class="fa fa-bars"></i></button>
            <label class="toolbar-label">标签云</label>
            <span class="float-right" id="switch-container">
                <div class="switch">
                    <input type="checkbox" id="dark-theme-switch" onchange="Theme.setTheme(this.checked ? 'dark' : 'light')" />
                    <label for="dark-theme-switch"></label>
                    <label class="form-control-label">Dark</label>
                </div>
            </span>
        </div>
        <div id="postsContainer">
            <div id="posts">
                <div class="each-tag">
                    <ul class="tags">
                        @if (tags != null && tags.Length > 0)
                            foreach (var item in tags)
                            {
                                <button class="button">
                                    <a href="/Blog/@repository.Id.ToHex()/Tags_Posts/@item">@item</a>
                                </button>
                            }

                    </ul>
                </div>
            </div>
        </div>
        @*{{template "footer_js.html" $}}*@
        @await Html.PartialAsync("Footer_js")
</body>
<script src="~/blog/themes/MaterialDesign/js/activate-power-mode.js"></script>
<script>
    //生成不规则大小标签云
    var tags = $(".each-tag a");
    tags.each(function () {
        var target = $(this);
        var randomNum = Math.floor((11 + Math.random() * (20 - 11 + 1)));
        target.css({ "font-size": randomNum + "px" });
        target.css({ "color": getRandomColor() });
    });
    //获取随机色
    function getRandomColor() {
        return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6);
    }
    POWERMODE.colorful = true;
    POWERMODE.shake = false;
    document.body.addEventListener('input', POWERMODE);
</script>
</html>